package eu.robico.simulator.simulatorinterface.actionpanel;

import java.util.List;

import eu.robico.simulator.simulatorinterface.actionpanel.objects.ActionPanelObject;
import eu.robico.simulator.simulatorinterface.actionpanel.objects.ActionPanelObjectFactory;
import eu.robico.simulator.simulatorinterface.actionpanel.objects.UpdateableActionPanelObject;

public class ActionPanelSimulationFactory 
{
	private ActionPanelSimulationFactory() { }
	
	public static void setupProgrammedPathSimulation(
			ActionPanel actionPanel,
			List<ActionPanelObject> objects, 
			List<UpdateableActionPanelObject> updateables
	){
		//Reset containers
		objects.clear();
		updateables.clear();
		
		//Top crossroads (left to right)
		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(50, 50)));
		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(310, 50)));
		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(570, 50)));
		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(830, 50)));
		//Central crossroads
		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(310, 220)));
		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(570, 220)));
		//Bottom crossroads
		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(50, 380)));
		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(310, 380)));
		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(570, 380)));
		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(830, 380)));

		//Lanes
		objects.add(ActionPanelObjectFactory.createColorLane(new Position(50, 70), new Position(50, 360)));
		objects.add(ActionPanelObjectFactory.createColorLane(new Position(70, 50), new Position(290, 50)));
		objects.add(ActionPanelObjectFactory.createColorLane(new Position(310, 70), new Position(310, 200)));
		objects.add(ActionPanelObjectFactory.createColorLane(new Position(310, 240), new Position(310, 360)));
		objects.add(ActionPanelObjectFactory.createColorLane(new Position(330, 50), new Position(550, 50)));
		objects.add(ActionPanelObjectFactory.createColorLane(new Position(330, 220), new Position(550, 220)));
		objects.add(ActionPanelObjectFactory.createColorLane(new Position(330, 380), new Position(550, 380)));
		objects.add(ActionPanelObjectFactory.createColorLane(new Position(570, 70), new Position(570, 200)));
		objects.add(ActionPanelObjectFactory.createColorLane(new Position(570, 240), new Position(570, 360)));
		objects.add(ActionPanelObjectFactory.createColorLane(new Position(590, 380), new Position(810, 380)));
		objects.add(ActionPanelObjectFactory.createColorLane(new Position(830, 70), new Position(830, 360)));

		UpdateableActionPanelObject robot = ActionPanelObjectFactory.createRobot(actionPanel, new Position(830, 70), 90);
		objects.add(robot);
		updateables.add(robot);
	}
	
	public static void setupObstacleOnColorlaneSimulation(
			ActionPanel actionPanel,
			List<ActionPanelObject> objects, 
			List<UpdateableActionPanelObject> updateables
	){
		//Reset containers
		objects.clear();
		updateables.clear();
		//Create lane
		objects.add(ActionPanelObjectFactory.createColorLane(new Position(50, 220), new Position(850, 220)));
		//Create obstacles
		objects.add(ActionPanelObjectFactory.createObstacle(new Position(100, 220)));
		objects.add(ActionPanelObjectFactory.createObstacle(new Position(800, 220)));
		//Create robot
		UpdateableActionPanelObject robot = ActionPanelObjectFactory.createRobot(actionPanel, new Position(400, 220), 180);
		objects.add(robot);
		updateables.add(robot);
		
//		//Create Action Panel Content
//		//Create utmost left color lane + crossroads
//		objects.add(ActionPanelObjectFactory.createColorLane(new Position(100, 80), new Position(100, 330)));
//		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(100, 60)));
//		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(100, 350)));
//		//Create bottom color lanes + crossroads
//		objects.add(ActionPanelObjectFactory.createColorLane(new Position(120, 350), new Position(425, 350)));
//		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(445, 350)));
//		objects.add(ActionPanelObjectFactory.createColorLane(new Position(465, 350), new Position(800, 350)));
//		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(820, 350)));
//		//Create top color lanes + crossroads
//		objects.add(ActionPanelObjectFactory.createColorLane(new Position(120, 60), new Position(425, 60)));
//		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(445, 60)));
//		objects.add(ActionPanelObjectFactory.createColorLane(new Position(465, 60), new Position(800, 60)));
//		objects.add(ActionPanelObjectFactory.createCrossRoads(new Position(820, 60)));
//		//Create center color lane
//		objects.add(ActionPanelObjectFactory.createColorLane(new Position(445, 80), new Position(445, 330)));
//		//Add an obstacle on the center lane
//		objects.add(ActionPanelObjectFactory.createObstacle(new Position(445, 205)));
////		//And another one on the top-left lane
////		objects.add(ActionPanelObjectFactory.createObstacle(new Position(360, 60)));
//		//Create robot
//		UpdateableActionPanelObject robot = ActionPanelObjectFactory.createRobot(this, new Position(780, 60), 180);
//		objects.add(robot);
//		updateables.add(robot);
	}
}
